package cn.javass.dp.decorator.example5;

import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class EncryptOutputStream2 extends FilterOutputStream {

    public EncryptOutputStream2(OutputStream out) {
        super(out);
    }

    @Override
    public void write(int a) throws IOException {
        //统一向后移动2位
        a = a + 2;

        if (a > 97 + 26) {
            a = a - 26;
        }

        super.write(a);
    }
}
